package ch.ethz.fcl.metrobuzz.data.od;

import ch.ethz.fcl.metrobuzz.data.scene.basemap.Node;

public class ODMatrixElement {
	Node origin;
	Node destination;

	private float probability;

	public ODMatrixElement(Node origin, Node destination) {
		this.origin = origin;
		this.destination = destination;
	}
	
	public void setProbability(float probability) {
		this.probability = probability;
	}

	public Node getOrigin() {
		return origin;
	}

	public Node getDestination() {
		return destination;
	}

	public float getProbability() {
		return probability;
	}

	@Override
	public boolean equals(Object o) {
		if (!(o instanceof ODMatrixElement))
			return false;

		ODMatrixElement od = (ODMatrixElement) o;
		if (!od.origin.getId().equals(origin.getId()))
			return false;

		if (!od.destination.getId().equals(destination.getId()))
			return false;

		return true;
	}

	@Override
	public int hashCode() {
		String str = origin.getId() + destination.getId();
		return str.hashCode();
	}

	@Override
	public String toString() {
		return "O: " + origin.getId() + " D: " + destination.getId();
	}
}
